<template>
    <div>
        <ul>
            <li v-for="(item,index) in menuData" :key="index" :class="{active:item.status}" @click="onChangeFn(index)">
                <img :src="item.status ? item.icon_active : item.icon" v-if='item.icon'>
                {{item.name}}
                <img src="@/assets/img/common/active-icon.png" v-if='item.status' class="active-icon">
            </li>
        </ul>
    </div>
</template>
<script>
export default {
    data () {
        return {
            // menuData:null
        }
    },
    props: 
    {
        menuData:{
            type:Array
        }
    },
    watch:{},
    computed:{},
    mounted () {},
    methods: {
        // 左侧菜单点击事件
        onChangeFn(index){
            this.menuData.forEach((element,i) => {
                if(index === i){
                    element.status = 1;
                    this.$router.push(element.path)
                    // this.$store.commit('getfileType',element.name)
                    sessionStorage.setItem('type',element.type)
                    this.$store.commit("getFilepath", [])
                    sessionStorage.setItem('path','')
                }else{
                    element.status = 0;
                } 
            });
        }
    }
}
</script>
<style lang="less" scoped>
@import url(../../assets/css/common/menufile.less);
</style>


